package ar.edu.utn.frgp.banco.servlets;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ar.edu.utn.frgp.banco.domain.Cliente;

import ar.edu.utn.frgp.banco.service.RecursoServiceCliente;
import ar.edu.utn.frgp.banco.service.impl.RecursoServiceClienteImpl;
import ar.edu.utn.frgp.banco.servlets.scope.ClienteBean;

public class ListarClienteServlet extends GenericServlet {
	private static final long serialVersionUID = 1L;

    /**
     * Default constructor. 
     */
    public ListarClienteServlet() {
        // TODO Auto-generated constructor stub
    }

	@Override
	public void realizarAccion(HttpServletRequest req, HttpServletResponse resp) throws Exception {
		RecursoServiceCliente service = new RecursoServiceClienteImpl();
		List<Cliente> clientes = service.listarTodo();
		ClienteBean bean = new ClienteBean();
		bean.setNombre("dummy");
		bean.setClientes(clientes);
		
		req.setAttribute("bean", bean);
		req.getRequestDispatcher("listarclientes.jsp").forward(req, resp);
	}

}
